package com.gome.base;

import com.gome.vue4j.core.AbstractVue4jComponent;
import com.gome.vue4j.core.FXMLPath;
import javafx.fxml.FXML;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 列表渲染
 */
@FXMLPath("/base/l5-view.fxml")
public class L5ForComponent extends AbstractVue4jComponent {
    @FXML
    public List<Actor> actors = new ArrayList<>(Arrays.asList(
            new Actor(1L,"张飞",28),
            new Actor(2L,"关羽",32),
            new Actor(3L,"刘备",36)
    ));

    @FXML
    void addActor(){
        long id = System.currentTimeMillis();
        actors.add(new Actor(id,"群众" + id,22));
        update();
    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Actor{
        Long id;
        String name;
        int age;
    }
}
